#include "constants.h"
#include "car.h"
#include "../arithmetic/fixed_point.h"


void turning_left(s_car **c)
{
  (*c)->d -= fp_div(FP_TURNING, (fp_mul((*c)->v, (*c)->v) + FP_TURN_LIMIT));
  (*c)->d %= FP_PI;
}


void turning_right(s_car **c)
{
  (*c)->d += fp_div(FP_TURNING, (fp_mul((*c)->v, (*c)->v) + FP_TURN_LIMIT));
  (*c)->d %= FP_PI;
}

void movement(s_car **c)
{
  (*c)->x += fp_mul((*c)->v, fp_cos((*c)->d));
  (*c)->y += fp_mul(- (*c)->v, fp_sin((*c)->d));
}

